<admintpl file="header" />
</head>
<body>
    <div class="wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:U('AuditFlow/index')}">审批流程</a></li>
            <li><a href="{:U('AuditFlow/add')}">新建审批流程</a></li>
            <li class="active"><a href="{:U('AuditFlow/edit', array('id'=>I('request.id/s','')))}">编辑审批流程</a></li>
        </ul>
        <form method="post" class="form-horizontal" action="{:U('AuditFlow/edit_post')}">
        	<input type="hidden" name="id" value="{$result.id}" >
            <div class="form-group">
                <label class="col-md-2 control-label">功能模块</label>
                <div class="col-md-6">
                    <select name="function" class="form-control"  >
                    	<option value=""></option>
                        <foreach name="audits" item="vo">
                            <option value="{$vo.code}" <if condition="$vo['code'] eq $result['function']">selected</if>>{$vo.name}</option>
                        </foreach>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">子功能</label>
                <div class="col-md-6">
                    <select name="subfunction" class="form-control">
                    	<option value=""></option>
                        <php>
                        	foreach($audits[$result['function']]['child'] as $key => $vo){
                            	echo "<option value=".$key." ".($key == $result['subfunction'] ? "selected" : "").">".$vo."</option>";
                           	}
                        </php>
                    </select>
                </div>
            </div>
            <div class="form-group item">
                <label class="col-md-2 control-label">审批流程</label>
                <div class="col-md-6">
                    <a class="btn btn-default add_line" href="javascript:void(0);">添加一行</a>
                </div>
            </div>
            <foreach name="auditDepts" item="vo">
            	<div class="form-group item">
                    <label class="col-md-2 control-label">{$vo.level}</label>
                    <div class="col-md-6">
                        <select name="department_id[]" class="form-control">
                        	<option value=""></option>
                            <foreach name="departments" item="dept">
                            	<option value="{$dept.id}" <if condition="$dept['id'] eq $vo['department_id']">selected</if>>{$dept.department_name}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
            </foreach>
            <div class="form-actions col-md-10 col-md-offset-2">
                <a class="btn btn-primary clickBtn" href="javascript:void(0);">{:L('SAVE')}</a>
                <a class="btn btn-default" href="javascript:history.back(-1);">{:L('BACK')}</a>
            </div>
        </form>
    </div>
    <script src="__PUBLIC__/js/common.js"></script>
    <script type="text/javascript">
		// 功能信息Json
		var subfunction = {$auditJson};
		var deptJson = {$departmentJson};
	</script>
    <script type="text/javascript" src="__TMPL__Public/assets/js/admin/auditflow.js"></script>
</body>
</html>